/*
 * Copyright (c) 2017 22420103@QQ.COM 版权所有
 */
package com.lehe.service.impl;

import com.lehe.dao.IndexDao;
import com.lehe.entry.IndexDto;
import com.lehe.entry.SqlParameterDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

/**
 * 微信公众号-用户首页
 *
 * @author 王丹
 * @since 2017-02-25
 */
@Transactional
@Service
public class IndexService extends AbstractService {

    @Autowired
    private IndexDao indexDao;

    public IndexDto queryUserInfoById(Long userId){
        IndexDto indexDto = indexDao.queryIndexDataByUserId(userId);
        SqlParameterDto parameterDto = new SqlParameterDto();
        parameterDto.setUserId(userId);
        parameterDto.setStartDate(LocalDate.now().toString());
        parameterDto.setEndDate(LocalDate.now().toString());
        indexDto.setPayCount(indexDao.queryIndexTotalPayFeeByUserId(parameterDto));
        return indexDto;
    }
}
